package com.iotechn.unimall.admin.myapi.conform;

import com.iotechn.unimall.core.annotation.HttpMethod;
import com.iotechn.unimall.core.annotation.HttpOpenApi;
import com.iotechn.unimall.core.annotation.HttpParam;
import com.iotechn.unimall.core.annotation.HttpParamType;
import com.iotechn.unimall.core.annotation.param.NotNull;
import com.iotechn.unimall.core.annotation.param.Range;
import com.iotechn.unimall.core.exception.ServiceException;
import com.iotechn.unimall.data.model.Page;
import com.iotechn.unimall.mydata.domain.ClassBean;
import com.iotechn.unimall.mydata.domain.ConformBean;
import com.iotechn.unimall.mydata.domain.User;
import com.iotechn.unimall.mydata.dto.UserAndStudentOrTeacher;
import org.springframework.http.ResponseEntity;
import org.springframework.web.multipart.MultipartFile;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;

@HttpOpenApi(group = "course.conform",description = "教师通知中心")
public interface IConformService {

    @HttpMethod(description = "创建班级")
    String create(
            @NotNull @HttpParam(name="tid",type = HttpParamType.COMMON, description = "教师用户id") Integer tid,
            @NotNull @HttpParam(name="cname",type = HttpParamType.COMMON, description = "班级名称") String cname
    ) throws ServiceException;

    @HttpMethod(description = "班级列表")
    List<ClassBean> classList(
            @NotNull @HttpParam(name="tid",type = HttpParamType.COMMON, description = "教师用户id") Integer tid
    ) throws ServiceException;


    @HttpMethod(description = "获取班级唯一代码")
    String classCode(
            @NotNull @HttpParam(name="tid",type = HttpParamType.COMMON, description = "教师用户id") Integer tid,
            @NotNull @HttpParam(name="cname",type = HttpParamType.COMMON, description = "班级名称") String cname
    ) throws ServiceException;


//    @HttpMethod(description = "上传excel")
//    String uploadExcel(
//            @NotNull @HttpParam(name="upload",type = HttpParamType.COMMON, description = "文件") MultipartFile upload
//    ) throws ServiceException, IOException;

    @HttpMethod(description = "批量让学生加入班级")
    List<User> addList(
            @NotNull @HttpParam(name="filename",type = HttpParamType.COMMON, description = "文件名") String filename,
            @NotNull @HttpParam(name="tid",type = HttpParamType.COMMON, description = "教师用户id") Integer tid,
            @NotNull @HttpParam(name="cname",type = HttpParamType.COMMON, description = "班级名称") String cname
           ) throws ServiceException, IOException;

    @HttpMethod(description = "删除班级")
    String delete(
            @NotNull @HttpParam(name="tid",type = HttpParamType.COMMON, description = "教师用户id") Integer tid,
            @NotNull @HttpParam(name="cname",type = HttpParamType.COMMON, description = "班级名称") String cname
    ) throws ServiceException;

    @HttpMethod(description = "在班级中除去这个学生")
    String deleteStudent(
            @NotNull @HttpParam(name="cid",type = HttpParamType.COMMON, description = "班级id") Integer cid,
            @NotNull @HttpParam(name="sid",type = HttpParamType.COMMON, description = "学生的userId") Integer sid
    ) throws ServiceException;

//    @HttpMethod(description = "老师上传资料")
//    String upload(
//            @NotNull @HttpParam(name="upload",type = HttpParamType.COMMON, description = "文件") MultipartFile upload,
//            @NotNull @HttpParam(name="tid",type = HttpParamType.COMMON, description = "用户id") Integer tid,
//            @NotNull @HttpParam(name="cid",type = HttpParamType.COMMON, description = "班级id") Integer cid
//            ) throws ServiceException, IOException;

    @HttpMethod(description = "老师上传通知")
    String uploadConform(
            @NotNull @HttpParam(name="userId",type = HttpParamType.COMMON, description = "学生的用户id") Integer userId,
            @NotNull @HttpParam(name="cid",type = HttpParamType.COMMON, description = "班级id") Integer cid,
            @NotNull @HttpParam(name="title",type = HttpParamType.COMMON, description = "标题") String title,
            @NotNull @HttpParam(name="data",type = HttpParamType.COMMON, description = "数据") String data
    ) throws ServiceException;

    @HttpMethod(description = "通知列表")
    List<ConformBean> conformList(
            @NotNull @HttpParam(name="cid",type = HttpParamType.COMMON, description = "班级名称") String cid,
            @Range(min = 1) @HttpParam(name = "pageNo", type = HttpParamType.COMMON, description = "当前页码") Integer pageNo,
            @Range(min = 1) @HttpParam(name = "limit", type = HttpParamType.COMMON, description = "页码长度") Integer limit

            ) throws ServiceException;

    @HttpMethod(description = "资料列表")
    List<ConformBean> dataList(
            @NotNull @HttpParam(name="cid",type = HttpParamType.COMMON, description = "班级名称") String cid,
            @Range(min = 1) @HttpParam(name = "pageNo", type = HttpParamType.COMMON, description = "当前页码") Integer pageNo,
            @Range(min = 1) @HttpParam(name = "limit", type = HttpParamType.COMMON, description = "页码长度") Integer limit

    ) throws ServiceException;

    @HttpMethod(description = "根据资料名称找到资料并返回")
    ResponseEntity<byte[]> download(
            @NotNull @HttpParam(name="dataName",type = HttpParamType.COMMON, description = "资料名称") String dataName
    ) throws ServiceException, IOException;

    @HttpMethod(description = "加入班级")
    String addClass(
            @NotNull @HttpParam(name="userId",type = HttpParamType.COMMON, description = "学生的用户id") Integer userId,
            @NotNull @HttpParam(name="code",type = HttpParamType.COMMON, description = "唯一验证码") String code
    ) throws ServiceException;

    @HttpMethod(description = "根据班级返回学生列表")
    List<UserAndStudentOrTeacher> listStudent(
            @NotNull @HttpParam(name="cid",type = HttpParamType.COMMON, description = "班级id") Integer cid
    ) throws ServiceException;

    @HttpMethod(description = "根据学生的id找到班级")
    List<Integer> getClass(
            @NotNull @HttpParam(name="userId",type = HttpParamType.COMMON, description = "学生的用户id") Integer userId
    ) throws ServiceException;


    @HttpMethod(description = "学生退出班级")
    String logoutClass(
            @NotNull @HttpParam(name="userId",type = HttpParamType.COMMON, description = "学生的用户id") Integer userId,
            @NotNull @HttpParam(name="cid",type = HttpParamType.COMMON, description = "班级id") Integer cid
    ) throws ServiceException;
}
